import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/util/DataUtil.dart';
import 'package:flutter_app/util/DialogUtil.dart';
import 'package:flutter_app/util/ToastUtil.dart';

///const AlertDialog({
///Key key,
///this.title, //对话框标题组件
///this.titlePadding, // 标题填充
///this.titleTextStyle, //标题文本样式
///this.content, // 对话框内容组件
///this.contentPadding = const EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 24.0), //内容的填充
///this.contentTextStyle,// 内容文本样式
///this.actions, // 对话框操作按钮组
///this.backgroundColor, // 对话框背景色
///this.elevation,// 对话框的阴影
///this.semanticLabel, //对话框语义化标签(用于读屏软件)
///this.shape, // 对话框外形
///})
///

class AlertDialogWidget extends StatelessWidget {
  final String? text;
  static const int six = 6;

  AlertDialogWidget({this.text}) : super();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text(text ?? ""),
        ),
        body: Container(
          padding: EdgeInsets.only(top: 15),
          alignment: Alignment.center,
          child: Column(
            children: [
              Container(
                child: TextButton(
                  child: Text("对话框[Dialog]"),
                  onPressed: () async {
//弹出对话框并等待其关闭
                    bool? delete = await DialogUtil.showConfirmDialog(
                        context, "提示", DataUtil.doalogContent);
                    if (delete == null) {
                      ToastUtil.toastShort("取消删除");
                    } else {
                      //返回成功的值
                      ToastUtil.toastShort("已确认删除");
//... 删除文件
                    }
                  },
                ),
              ),
              SizedBox(
                height: 30,
              ),
              Container(
                child: TextButton(
                  child: Text("对话框[SimpleDialog]"),
                  onPressed: () async {
//弹出对话框并等待其关闭
                    DialogUtil.changeLanguage(context, "请选择语言");
                  },
                ),
              ),
              SizedBox(
                height: 30,
              ),
              Container(
                child: TextButton(
                  child: Text("对话框[ListDialog]"),
                  onPressed: () async {
//弹出对话框并等待其关闭
                    DialogUtil.showListDialog(context, "请选择");
                  },
                ),
              ),
              Column(
                children: [
                  Text(
                    text ?? "",
                    style: TextStyle(),
                  ),
                ],
              ),
            ],
          ),
        ));
  }
}
